<template>
  <div>
    <p>当前count值：{{ this.$store.state.count }}</p>
    <button @click="handle1">+1</button>
    <button @click="handle2">+N</button>
  </div>
</template>

<script>
import { mapMutations } from "vuex"
export default {
  data() {
    return {}
  },
  methods: {
    ...mapMutations(['addN','subN']),
    handle1() {
      this.$store.commit("add")
    },
    handle2() {
      this.addN(3)
      this.subN(3)
    }
  }
}
</script>

<style>
</style>